package com.itYuan.reggie.common;

import java.time.LocalDateTime;

/**
 * 基于ThreadLocal封装工具类，用户保存和获取当前登录的用户id
 * @author jhy
 * @version 1.0
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 设置值
     * @param id
     */
    public static void setId(Long id){
        threadLocal.set(id);
    }

    /**
     * 获得值
     * @return
     */
    public static Long getId(){
        return threadLocal.get();
    }
}
